home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "XceedTools"
- '==================================================================
- ' Description: Module for Getting Started Sample Application
- ' Copyright: ⌐ Copyright 1995-1999 Xceed Software Inc.
- ' All Rights Reserved.
- '==================================================================
-
- Option Explicit
-
-
- '------------------------------------------------------------------------------------
- ' Public constants
- '------------------------------------------------------------------------------------
-
- Public Const cBasePathHint = "BasePath property:" & vbCrLf & _
- "This path determines where entries in the FilesToProcess and FilesToExclude " & _
- "properties are relative to. The base path never appears in the zip file, " & _
- "even if PreservePaths = True. Only the portion of the path and filename specified " & _
- "in the FilesToProcess property is actually stored in the zip file. Therefore, " & _
- "BasePath helps you control what portions of paths are stored in the zip file. " & _
- "(The BasePath property is irrelevant when you are using absolute paths)"
-
- Public Const cFilesToProcessHint = "FilesToProcess property:" & vbCrLf & _
- "Multiline string that contains all the filenames and/or file masks " & _
- "to be processed (zipped, unzipped, etc). If you entered a path in the " & _
- "BasePath property, all entries with relative paths will be relative to " & _
- "the specified base path. The pipe character '|' can be used instead of the linefeed " & _
- "to separate entries for the FilesToProcess property."
-
- Public Const cFilesToExcludeHint = "FilesToExclude property:" & vbCrLf & _
- "Multiline string that contains all filenames and/or file masks " & _
- "to exclude from the files to be processed by the FilesToProcess " & _
- "property. These entries are also relative to the path specified in the " & _
- "BasePath property if its not empty."
-
- Public Const cProcessSubfolderHint = "ProcessSubFolders property:" & vbCrLf & _
- "If set to True, the contents of all encoutered subfolders will be " & _
- "processed."
-
- Public Const cZipFilenameHint = "ZipFilename property:" & vbCrLf & _
- "The filename of the zip file to work with. When unzipping, this file must " & _
- "exist. When zipping, if the file exists, it's updated. Otherwise, it is " & _
- "created. You must enter an absolute path for this property. The BasePath " & _
- "property does not interfere with the ZipFilename property."
-
- Public Const cPreservePathsHint = "PreservePaths property:" & vbCrLf & _
- "If set to True, the zip file will store both the path and the filename " & _
- "of each file that is being zipped. As usual, the portion of a file's path that " & _
- "is specified in the BasePath property will not be stored in the zip file. " & _
- "When PreservePaths is set to False, only filenames (no paths) are stored."
-
- Public Const cUseTempFileHint = "UseTempFile property:" & vbCrLf & _
- "If set to true, all zipping operations will be performed on a temp file " & _
- "located in the folder specified in the TempFolder property. Otherwise, the " & _
- "operation is performed directly on the zip file without using a temp file. " & _
- "You cannot remove files from an existing zip file, or update files already " & _
- "in an existing zip files without setting this property to True."
-
- Public Const cTempFolderHint = "TempFolder property:" & vbCrLf & _
- "Location of the temp file when the UseTempFile property is set to True. " & _
- "When you leave this property empty, the Windows default temp directory " & _
- "is used."
-
- Public Const cRequiredFileAttributesHint = "RequiredFileAttributes property:" & vbCrLf & _
- "Bit-field value that specifies all attributes that a file must " & _
- "have in order to be included in the process."
-
- Public Const cExcludedFileAttributesHint = "ExcludedFileAttributes property:" & vbCrLf & _
- "Bit-field value that specifies all attributes that a file must " & _
- "NOT have in order to be included in the process."
-
- Public Const cMinDateToProcessHint = "MinDateToProcess property:" & vbCrLf & _
- "Minimum value of a file's 'Last modifed date' required in order to be " & _
- "included in the process."
-
- Public Const cMaxDateToProcessHint = "MaxDateToProcess property:" & vbCrLf & _
- "Maximum value of a file's 'Last modifed date' required in order to be " & _
- "included in the process."
-
- Public Const cMinSizeToProcessHint = "MinSizeToProcess property:" & vbCrLf & _
- "Minimum file size that a file must have in order to be " & _
- "included in the process."
-
- Public Const cMaxSizeToProcessHint = "MaxSizeToProcess property:" & vbCrLf & _
- "Maximum file size that a file must have in order to be " & _
- "included in the process."
-
- Public Const cUnzipToFolderHint = "UnzipToFolder property:" & vbCrLf & _
- "Destination folder for files being unzipped. In this sample, the PreservePaths " & _
- "property is set to True, so if files are stored in the zip file with paths, " & _
- "those stored paths will be recreated inside the destination folder specified " & _
- "by the UnzipToFolder property."
-
- Public Const cSkipIfExistingHint = "SkipIfExisting property:" & vbCrLf & _
- "If the destination file (located in a zip file that is being updated, or " & _
- "on disk when a zip file is being unzipped) already exists, and this " & _
- "property is set to True, then the file won't be overwritten. This has the " & _
- "effect of only processing files that don't exist in the destination zip file or " & _
- "unzipping folder."
-
- Public Const cSkipIfNotExistingHint = "SkipIfNotExisting property:" & vbCrLf & _
- "Setting this property to True will cause only files that don't already " & _
- "exist in the destination unzipping location (when unzipping) or the zip file " & _
- "(when zipping) to be skipped."
-
- Public Const cSkipIfOlderDateHint = "SkipIfOlderDate:" & vbCrLf & _
- "When updating a file (in a zip file while zipping, or on disk while unzipping)" & _
- ", the file is skipped if the existing file's 'Last modified date' is greater " & _
- "than the file being zipped or unzipped."
-
- Public Const cSkipIfOlderVersionHint = "SkipIfOlderVersion property:" & vbCrLf & _
- "When updating a file (in a zip while zipping, or on disk while unzipping)" & _
- ", the file is skipped if the existing file's version resource value is " & _
- "greater than the file being zipped or unzipped."
-
- Public Const cZipFilenameSfxHint = "ZipFilename property:" & vbCrLf & _
- "The filename of the zip file to work on. When creating or updating self-extracting " & _
- "zip files, you should enter an executable filename (use a .EXE extension)"
-
- Public Const cSfxBinaryModuleHint = "SfxBinaryModule property:" & vbCrLf & _
- "This binary file will be prepended to the zip file, with configuration data " & _
- "if the binary is one of the Xceed Self-Extractor Module binaries. If you " & _
- "leave this field empty, a regular (non-sfx) zip file will be created."
-
- Public Const cSfxStringsHint = "SfxStrings property:" & vbCrLf & _
- "This array contains all the strings displayed by the Xceed Self-Extractor Module " & _
- "binaries. For example, the 'xssTitle' index contains the title displayed by " & _
- "all dialog boxes."
-
- Public Const cSfxMessagesHint = "SfxMessages property:" & vbCrLf & _
- "This array contains all messages displayed by the Xceed Self-Extractor Module " & _
- "binaries. These messages often appear in their own dialog boxes. If a particular " & _
- "message is left empty, the dialog box won't be displayed. As an example, " & _
- "leaving this field empty will avoid displaying an introduction message dialog."
-
- Public Const cPreviewFilesHint = "PreviewFiles method:" & vbCrLf & _
- "Lets you scan the disk for files that would be zipped with the current " & _
- "property settings. A PreviewingFile event is triggered for each file that " & _
- "matches an entry in the FilesToProcess property. Set this method's " & _
- "parameter to True to have the library calculate the compressed size of " & _
- "the previewed files."
-
- Public Const cListZipContentsHint = "ListZipContents method:" & vbCrLf & _
- "Lets you view the zip file's contents. Due to the fact that the FilesToProcess " & _
- "property and the other filtering properties affect the ListZipContents method, " & _
- "you can use it to preview which files would be unzipped by the Unzip method " & _
- "if it were called with the current property settings. A ListingFile event is " & _
- "triggered for each file in the zip file that is listed."
-
- Public Const cZipHint = "Zip method:" & vbCrLf & _
- "Lets you zip files. Only files that match all the entries in the FilesToProcess and " & _
- "filtering properties will be processed. For each file that matches the FilesToProcess " & _
- "property, the ZipPreprocessingFile event is triggered. That event provides you with " & _
- "the chance to change the inclusion state of a file, or to change its information " & _
- "before it is stored in the zip file."
-
- Public Const cUnzipHint = "Unzip method:" & vbCrLf & _
- "Lets you unzip files. Only files that match all the entries in the FilesToProcess and " & _
- "filtering properties will be processed. For each file that matches the FilesToProcess " & _
- "property, the UnzipPreprocessingFile event is triggered. That event provides you with " & _
- "the chance to change the inclusion state of a file, or to change its information " & _
- "before it is written to the destination unzipping folder."
-
- Public Const cZipSfxHint = "Zip method with self-extracting zip files:" & vbCrLf & _
- "It's just like creating a regular (non-sfx) zip file, but if you enter a value for " & _
- "the SfxBinaryModule property, the binary (or any file for that matter) is " & _
- "prepended to the zip file. The zip file is now self-extracting because " & _
- "the binary knows how to unzip the rest of the data after itself. Furthermore, if " & _
- "the library recognises an Xceed binary, it will add config data to the binary so that the " & _
- "self-extracting zip file can display intro messages and have custom behavior."
-
-
- '------------------------------------------------------------------------------------
- ' Fills a listbox with possible file attributes
- '------------------------------------------------------------------------------------
- Public Sub FillAttributeList(lstAttrib As ListBox)
- lstAttrib.Clear
-
- lstAttrib.AddItem "Archive"
- lstAttrib.ItemData(lstAttrib.ListCount - 1) = xfaArchive
-
- lstAttrib.AddItem "Read-Only"
- lstAttrib.ItemData(lstAttrib.ListCount - 1) = xfaReadOnly
-
- lstAttrib.AddItem "Hidden"
- lstAttrib.ItemData(lstAttrib.ListCount - 1) = xfaHidden
-
- lstAttrib.AddItem "System"
- lstAttrib.ItemData(lstAttrib.ListCount - 1) = xfaSystem
-
- lstAttrib.AddItem "Folder"
- lstAttrib.ItemData(lstAttrib.ListCount - 1) = xfaFolder
-
- lstAttrib.AddItem "Volume"
- lstAttrib.ItemData(lstAttrib.ListCount - 1) = xfaVolume
-
- lstAttrib.AddItem "Compressed"
- lstAttrib.ItemData(lstAttrib.ListCount - 1) = xfaCompressed
- End Sub
-
- '------------------------------------------------------------------------------------
- ' This function returns a Long value representing the file attributes checked in
- ' a listbox.
- '------------------------------------------------------------------------------------
- Public Function GetSelectedAttributes(lstAttrib As ListBox) As Long
- Dim lAttrib As Long
- Dim i As Integer
-
- lAttrib = xfaNone
-
- For i = 0 To lstAttrib.ListCount - 1
- If lstAttrib.Selected(i) Then
- lAttrib = lAttrib + lstAttrib.ItemData(i)
- End If
- Next i
-
- GetSelectedAttributes = lAttrib
- End Function
-
- '------------------------------------------------------------------------------------
- ' Initializes a listbox by checking the attributes corresponding to the given
- ' attribute mask.
- '------------------------------------------------------------------------------------
- Public Sub SetSelectedAttributes(lstAttrib As ListBox, xAttrib As xcdFileAttributes)
- Dim i As Integer
-
- For i = 0 To lstAttrib.ListCount - 1
- lstAttrib.Selected(i) = ((lstAttrib.ItemData(i) And xAttrib) > 0)
- Next i
- End Sub
-
- '------------------------------------------------------------------------------------
- ' Sets XceedZip instance with default property values.
- '------------------------------------------------------------------------------------
- Public Sub SetDefaultProperties(xZip As XceedZip)
- xZip.BasePath = ""
- xZip.CompressionLevel = xclHigh
- xZip.EncryptionPassword = ""
- xZip.RequiredFileAttributes = xfaNone
- xZip.ExcludedFileAttributes = xfaFolder + xfaVolume
- xZip.FilesToProcess = ""
- xZip.FilesToExclude = ""
- xZip.MinDateToProcess = DateSerial(1900, 1, 1)
- xZip.MaxDateToProcess = DateSerial(9999, 12, 31)
- xZip.MinSizeToProcess = 0
- xZip.MaxSizeToProcess = 0 ' Zero means no upper limit
- xZip.SplitSize = 0 ' Zero means no split
- xZip.PreservePaths = True
- xZip.ProcessSubfolders = False
- xZip.SkipIfExisting = False
- xZip.SkipIfNotExisting = False
- xZip.SkipIfOlderDate = False
- xZip.SkipIfOlderVersion = False
- xZip.TempFolder = "" 'Empty means default Windows temp folder
- xZip.UseTempFile = True
- xZip.UnzipToFolder = ""
- xZip.ZipFilename = ""
- xZip.SpanMultipleDisks = xdsRemovableDrivesOnly
- xZip.ExtraHeaders = xehNone
- End Sub
-